/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Servlet.My;

import Model.My.DynamicList;
import RssEasy.Core.CookieHelper;
import RssEasy.Core.HttpRequestHelper;
import RssEasy.Core.SignVerifyRequestHelper;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author admin
 */
@WebServlet(name = "my_add", urlPatterns = {"/my/add"})
public class add extends SignVerifyRequestHelper {

   protected HttpRequestHelper request(HttpServletRequest request, HttpServletResponse response) {
        super.request(request, response);
        try {
            CookieHelper cook = new CookieHelper(request, response);
            DynamicList dy = new DynamicList(pageContext);
            dy.timestamp();
            dy.keyvalue("title", this.get("title")).keyvalue("content", this.get("content")).keyvalue("myid", cook.Get("myid"));
            dy.append().submit();
            out.print("1");
        } catch (Exception e) {
            out.print("{\"error\":\"" + e.getMessage() + "\"}");

        }
             return this;
    }

}
